<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>Class: Ankoder::Base</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
  <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
  <script type="text/javascript">
  // <![CDATA[

  function popupCode( url ) {
    window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
  }

  function toggleCode( id ) {
    if ( document.getElementById )
      elem = document.getElementById( id );
    else if ( document.all )
      elem = eval( "document.all." + id );
    else
      return false;

    elemStyle = elem.style;
    
    if ( elemStyle.display != "block" ) {
      elemStyle.display = "block"
    } else {
      elemStyle.display = "none"
    }

    return true;
  }
  
  // Make codeblocks hidden by default
  document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
  
  // ]]>
  </script>

</head>
<body>



    <div id="classHeader">
        <table class="header-table">
        <tr class="top-aligned-row">
          <td><strong>Class</strong></td>
          <td class="class-name-in-header">Ankoder::Base</td>
        </tr>
        <tr class="top-aligned-row">
            <td><strong>In:</strong></td>
            <td>
                <a href="../../files/lib/ankoder/base_rb.html">
                lib/ankoder/base.rb
                </a>
        <br />
            </td>
        </tr>

        <tr class="top-aligned-row">
            <td><strong>Parent:</strong></td>
            <td>
                Object
            </td>
        </tr>
        </table>
    </div>
  <!-- banner header -->

  <div id="bodyContent">



  <div id="contextContent">

    <div id="description">
      <p>
You can connect to the _ankoderapi_session service permanently
</p>
<p>
You can access all the resources and manipulate the objects like in
ActiveRecord
</p>
<pre>
 v = Video.find(15).update_attributes :name =&gt; &quot;My edited title&quot;
 puts v.title
</pre>

    </div>


   </div>

    <div id="method-list">
      <h3 class="section-bar">Methods</h3>

      <div class="name-list">
      <a href="#M000018">count</a>&nbsp;&nbsp;
      <a href="#M000014">create</a>&nbsp;&nbsp;
      <a href="#M000023">destroy</a>&nbsp;&nbsp;
      <a href="#M000016">destroy</a>&nbsp;&nbsp;
      <a href="#M000017">destroy_all</a>&nbsp;&nbsp;
      <a href="#M000012">disconnect!</a>&nbsp;&nbsp;
      <a href="#M000011">establish_connection!</a>&nbsp;&nbsp;
      <a href="#M000013">find</a>&nbsp;&nbsp;
      <a href="#M000019">new</a>&nbsp;&nbsp;
      <a href="#M000024">reload</a>&nbsp;&nbsp;
      <a href="#M000020">save</a>&nbsp;&nbsp;
      <a href="#M000021">save!</a>&nbsp;&nbsp;
      <a href="#M000015">update</a>&nbsp;&nbsp;
      <a href="#M000022">update_attributes</a>&nbsp;&nbsp;
      </div>
    </div>

  </div>


    <!-- if includes -->

    <div id="section">





    <div id="attribute-list">
      <h3 class="section-bar">Attributes</h3>

      <div class="name-list">
        <table>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">attributes</td>
          <td class="context-item-value">&nbsp;[R]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">errors</td>
          <td class="context-item-value">&nbsp;[R]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        </table>
      </div>
    </div>
      


    <!-- if method_list -->
    <div id="methods">
      <h3 class="section-bar">Public Class methods</h3>

      <div id="method-M000018" class="method-detail">
        <a name="M000018"></a>

        <div class="method-heading">
          <a href="Base.src/M000018.html" target="Code" class="method-signature"
            onclick="popupCode('Base.src/M000018.html');return false;">
          <span class="method-name">count</span><span class="method-args">(field=nil, options={})</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Count request
</p>
<p>
Accept :conditions like in <a href="Base.html#M000013">Base#find</a>
</p>
        </div>
      </div>

      <div id="method-M000014" class="method-detail">
        <a name="M000014"></a>

        <div class="method-heading">
          <a href="Base.src/M000014.html" target="Code" class="method-signature"
            onclick="popupCode('Base.src/M000014.html');return false;">
          <span class="method-name">create</span><span class="method-args">(attributes={})</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Create the object
</p>
<pre>
  Download.create :url =&gt; &quot;http://host.com/video.avi&quot;
</pre>
        </div>
      </div>

      <div id="method-M000016" class="method-detail">
        <a name="M000016"></a>

        <div class="method-heading">
          <a href="Base.src/M000016.html" target="Code" class="method-signature"
            onclick="popupCode('Base.src/M000016.html');return false;">
          <span class="method-name">destroy</span><span class="method-args">(id)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Destroy the object passing its ID
</p>
<pre>
  Profile.destroy 12
</pre>
        </div>
      </div>

      <div id="method-M000017" class="method-detail">
        <a name="M000017"></a>

        <div class="method-heading">
          <a href="Base.src/M000017.html" target="Code" class="method-signature"
            onclick="popupCode('Base.src/M000017.html');return false;">
          <span class="method-name">destroy_all</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Destroy all the objects
</p>
<pre>
  Video.destroy_all
</pre>
        </div>
      </div>

      <div id="method-M000012" class="method-detail">
        <a name="M000012"></a>

        <div class="method-heading">
          <a href="Base.src/M000012.html" target="Code" class="method-signature"
            onclick="popupCode('Base.src/M000012.html');return false;">
          <span class="method-name">disconnect!</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
        </div>
      </div>

      <div id="method-M000011" class="method-detail">
        <a name="M000011"></a>

        <div class="method-heading">
          <a href="Base.src/M000011.html" target="Code" class="method-signature"
            onclick="popupCode('Base.src/M000011.html');return false;">
          <span class="method-name">establish_connection!</span><span class="method-args">(options={})</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Establish the connection for all your session
</p>
        </div>
      </div>

      <div id="method-M000013" class="method-detail">
        <a name="M000013"></a>

        <div class="method-heading">
          <a href="Base.src/M000013.html" target="Code" class="method-signature"
            onclick="popupCode('Base.src/M000013.html');return false;">
          <span class="method-name">find</span><span class="method-args">(*args)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Find objects
</p>
<p>
Arguments:
</p>
<ul>
<li><tt>ID</tt> ID of the object

</li>
<li><tt>:first</tt> retrieve the first result

</li>
<li><tt>:all</tt> retrieve all the results

</li>
</ul>
<p>
Options:
</p>
<ul>
<li><tt>:conditions</tt> {:fieldname =&gt; &quot;keyword&quot;} or {:fieldname
=&gt; /[0-9]+/}

</li>
<li><tt>:order</tt> to sort the result

</li>
<li><tt>:limit</tt> limit the number of result to return

</li>
<li><tt>:include</tt> fetch the object to include

<pre>
  Profile.find(:all, :conditions =&gt; {:name =&gt; /mobile/i})
  Profile.find(:all, :conditions =&gt; {:width =&gt; '&lt;320'})
  Job.find(:all, :include =&gt; &quot;video&quot;, :order =&gt; &quot;created_at DESC&quot;, :limit =&gt; 3)
  Video.find :first
  Download.find(5)
</pre>
</li>
</ul>
        </div>
      </div>

      <div id="method-M000019" class="method-detail">
        <a name="M000019"></a>

        <div class="method-heading">
          <a href="Base.src/M000019.html" target="Code" class="method-signature"
            onclick="popupCode('Base.src/M000019.html');return false;">
          <span class="method-name">new</span><span class="method-args">(attributes={})</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Instanciate a <a href="Base.html#M000019">new</a> object
</p>
<pre>
  Profile.new :name =&gt; &quot;test format&quot;, :sample_rate =&gt; 24000
</pre>
        </div>
      </div>

      <div id="method-M000015" class="method-detail">
        <a name="M000015"></a>

        <div class="method-heading">
          <a href="Base.src/M000015.html" target="Code" class="method-signature"
            onclick="popupCode('Base.src/M000015.html');return false;">
          <span class="method-name">update</span><span class="method-args">(id, attributes={})</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Update the object passing its ID
</p>
<pre>
  Video.update 15, :name =&gt; &quot;my title&quot;
</pre>
        </div>
      </div>

      <h3 class="section-bar">Public Instance methods</h3>

      <div id="method-M000023" class="method-detail">
        <a name="M000023"></a>

        <div class="method-heading">
          <a href="Base.src/M000023.html" target="Code" class="method-signature"
            onclick="popupCode('Base.src/M000023.html');return false;">
          <span class="method-name">destroy</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Destroy the object
</p>
<pre>
  Video.find(56).destroy
</pre>
        </div>
      </div>

      <div id="method-M000024" class="method-detail">
        <a name="M000024"></a>

        <div class="method-heading">
          <a href="Base.src/M000024.html" target="Code" class="method-signature"
            onclick="popupCode('Base.src/M000024.html');return false;">
          <span class="method-name">reload</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Reload the current object
</p>
<pre>
  j = Job.find(5400)
  j.reload
</pre>
        </div>
      </div>

      <div id="method-M000020" class="method-detail">
        <a name="M000020"></a>

        <div class="method-heading">
          <a href="Base.src/M000020.html" target="Code" class="method-signature"
            onclick="popupCode('Base.src/M000020.html');return false;">
          <span class="method-name">save</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Save the object.
</p>
<p>
If the object doesn&#8216;t exist, it will be created, otherwise updated.
If an error occurred, @errors will be filled. This method doesn&#8216;t
raise.
</p>
        </div>
      </div>

      <div id="method-M000021" class="method-detail">
        <a name="M000021"></a>

        <div class="method-heading">
          <a href="Base.src/M000021.html" target="Code" class="method-signature"
            onclick="popupCode('Base.src/M000021.html');return false;">
          <span class="method-name">save!</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Save the current object
</p>
<p>
Raise if an error occurred. Return self.
</p>
        </div>
      </div>

      <div id="method-M000022" class="method-detail">
        <a name="M000022"></a>

        <div class="method-heading">
          <a href="Base.src/M000022.html" target="Code" class="method-signature"
            onclick="popupCode('Base.src/M000022.html');return false;">
          <span class="method-name">update_attributes</span><span class="method-args">(attributes={})</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Update the object with the given attributes
</p>
<pre>
  Video.find(10).update_attributes :name =&gt; &quot;test title&quot;
</pre>
        </div>
      </div>


    </div>


  </div>


<div id="validator-badges">
  <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>

</body>
</html>